<div class="page-content" >
	<div class="panel panel-default">
		<div class="panel-heading">
			<ul class="breadcrumb">
                    <li><a href="<{:U('emailSet')}>">邮件设置管理</a> </li>
                    <li>邮件设置</li>
             </ul>
		</div>
		<div class="panel-body">
			 <form id="myform" method="post" class="form-horizontal"  action="<{:U('setEmail')}>">
                    	
                            <div class="form-group">
                                <label for="input-title" class="col-sm-2 control-label">SMTP服务器：</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control" id="smtp" name="smtp" value="<{$data['smtp']}>" />
                                </div>
                            </div>
							<div class="form-group">
                                <label for="input-title" class="col-sm-2 control-label">SMTP端口：</label>
                                <div class="col-sm-7">
                            
                                    <input type="text" class="form-control" id="port" name="port" value="<{$data['port']}>">
                                
                                </div>
                            </div>
							<div class="form-group">
                                <label for="input-title" class="col-sm-2 control-label">发件人邮件地址：</label>
                                <div class="col-sm-7">
                            
                                    <input type="text" class="form-control" id="url" name="url" value="<{$data['url']}>" />
                                
                                </div>
                            </div>

                             <div class="form-group">
                                <label for="input-title" class="col-sm-2 control-label" >SMTP身份用户名：</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control" id="username" name="username" value="<{$data.username}>">
                                    
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label for="input-title" class="col-sm-2 control-label">SMTP身份验证密码：</label>
                                <div class="col-sm-7">
                                    <input type="password" class="form-control" id="password" name="password" value="<{$data.password}>">
                            
                                </div>
                            </div>
							<div class="form-group">
                                <label for="input-title" class="col-sm-2 control-label">测试邮件地址：</label>
                                <div class="col-sm-5">
                                    <input type="text" class="form-control" id="ceshiurl" name="ceshiurl" value="<{$data.ceshiurl}>"></div>
									 <div  class="col-sm-3" style="margin-top:3px;">
									<a class="btn btn-primary btn-xs" onclick="testEmail()">测试</a>
                            
                                </div>
                            </div>

            
                             <div class="form-group">
					<div class="col-sm-offset-2 col-sm-7">
						<button type="submit" class="btn btn-primary">保存</button>
					</div>
				</div>

                          
                     </form>
		</div>
	</div>
</div>
<script>
 
$(function(){
    $(".form-horizontal").bootstrapValidator({
        message: '您填入的值不合法',
        fields:{
            keyword: {
                message: '序列号',
                validators: {
                    notEmpty: {
                        message: '序列号不能为空'
                    }, 
                }
            },
			 code: {
                message: '密码',
                validators: {
                    notEmpty: {
                        message: '密码不能为空'
                    }, 
                }
            },
			
			 

        }
    });
	
 
});
 </script> 
<script>
 function testEmail(){
  var ceshiurl=$("#ceshiurl").val();
  $.get("<{:U('testEmail')}>",{to:ceshiurl},function(){
   alert('邮件已发送，如果已收到邮件，说明您邮件配置成功了');
  });
 }
</script>
 